/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * projetoEditarArvoreAtividades.java
 *
 * Created on Nov 15, 2010, 12:17:17 PM
 */
package NajaTaskClient.interfaces.gerente;

import javax.swing.JDialog;

/**
 *
 * @author Nidorx
 */
public class projetoEditarArvore extends javax.swing.JDialog {

    tarefaNova dialogNovaTarefa;
    atividadeNova dialogNovaAtividade;

    /** Creates new form projetoEditarArvoreAtividades */
    public projetoEditarArvore(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        dialogNovaTarefa = new tarefaNova(parent, true);
        dialogNovaAtividade = new atividadeNova(parent, true);
        initComponents();
        this.setLocationRelativeTo(getRootPane());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTreeAtividades = new javax.swing.JTree();
        jPanelResumoAtividade = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabelAtividadeNome = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabelAtividadeAtivo = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabelAtividadePercent = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextAreaAtividadeDescricao = new javax.swing.JTextArea();
        buttonEditar = new javax.swing.JButton();
        buttonSair = new javax.swing.JButton();
        buttonNovaAtividade = new javax.swing.JButton();
        buttonNovaTarefa = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel1.setAutoscrolls(true);

        javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("Projeto XXX");
        javax.swing.tree.DefaultMutableTreeNode treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Implementação");
        javax.swing.tree.DefaultMutableTreeNode treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("Requisitos");
        javax.swing.tree.DefaultMutableTreeNode treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Tarefa 01");
        treeNode3.add(treeNode4);
        treeNode2.add(treeNode3);
        treeNode1.add(treeNode2);
        treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Protótipo");
        treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("Design");
        treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("Interfaces");
        javax.swing.tree.DefaultMutableTreeNode treeNode5 = new javax.swing.tree.DefaultMutableTreeNode("Tarefa 02");
        treeNode4.add(treeNode5);
        treeNode3.add(treeNode4);
        treeNode2.add(treeNode3);
        treeNode1.add(treeNode2);
        jTreeAtividades.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
        jScrollPane1.setViewportView(jTreeAtividades);

        jPanelResumoAtividade.setBorder(javax.swing.BorderFactory.createTitledBorder("Resumo da atividade"));

        jLabel1.setText("Nome da atividade");

        jLabelAtividadeNome.setFont(new java.awt.Font("sansserif", 1, 12));
        jLabelAtividadeNome.setText("Nome da atividade");

        jLabel3.setText("Ativo");

        jLabelAtividadeAtivo.setFont(new java.awt.Font("sansserif", 1, 12));
        jLabelAtividadeAtivo.setText("sim");

        jLabel5.setText("% conlcuída");

        jLabelAtividadePercent.setFont(new java.awt.Font("sansserif", 1, 12));
        jLabelAtividadePercent.setText("25%");

        jLabel7.setText("Descrição");

        jTextAreaAtividadeDescricao.setBackground(new java.awt.Color(204, 204, 204));
        jTextAreaAtividadeDescricao.setColumns(20);
        jTextAreaAtividadeDescricao.setRows(5);
        jScrollPane2.setViewportView(jTextAreaAtividadeDescricao);

        buttonEditar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/NajaTaskClient/recursos/icons/edit.png"))); // NOI18N
        buttonEditar.setText("Editar");

        javax.swing.GroupLayout jPanelResumoAtividadeLayout = new javax.swing.GroupLayout(jPanelResumoAtividade);
        jPanelResumoAtividade.setLayout(jPanelResumoAtividadeLayout);
        jPanelResumoAtividadeLayout.setHorizontalGroup(
            jPanelResumoAtividadeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelResumoAtividadeLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelResumoAtividadeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelResumoAtividadeLayout.createSequentialGroup()
                        .addGroup(jPanelResumoAtividadeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelResumoAtividadeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelResumoAtividadeLayout.createSequentialGroup()
                                .addComponent(jLabelAtividadeAtivo)
                                .addGap(87, 87, 87)
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabelAtividadePercent))
                            .addComponent(jLabelAtividadeNome)))
                    .addGroup(jPanelResumoAtividadeLayout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE))
                    .addComponent(buttonEditar, javax.swing.GroupLayout.Alignment.TRAILING))
                .addContainerGap())
        );
        jPanelResumoAtividadeLayout.setVerticalGroup(
            jPanelResumoAtividadeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelResumoAtividadeLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelResumoAtividadeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jLabelAtividadeNome))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelResumoAtividadeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel5)
                    .addComponent(jLabelAtividadePercent)
                    .addComponent(jLabelAtividadeAtivo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelResumoAtividadeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addComponent(buttonEditar))
        );

        buttonSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/NajaTaskClient/recursos/icons/exit.png"))); // NOI18N
        buttonSair.setText("Sair");
        buttonSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSairActionPerformed(evt);
            }
        });

        buttonNovaAtividade.setText("Nova atividade");
        buttonNovaAtividade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonNovaAtividadeActionPerformed(evt);
            }
        });

        buttonNovaTarefa.setText("Nova tarefa");
        buttonNovaTarefa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonNovaTarefaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanelResumoAtividade, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(100, 100, 100)
                        .addComponent(buttonSair)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                        .addComponent(buttonNovaAtividade)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(buttonNovaTarefa)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jPanelResumoAtividade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(buttonSair)
                            .addComponent(buttonNovaTarefa)
                            .addComponent(buttonNovaAtividade)))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void buttonSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSairActionPerformed
        this.dispose();
    }//GEN-LAST:event_buttonSairActionPerformed

    private void buttonNovaTarefaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonNovaTarefaActionPerformed
        this.exibeDialogNovoTarefa();
    }//GEN-LAST:event_buttonNovaTarefaActionPerformed

    private void buttonNovaAtividadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonNovaAtividadeActionPerformed
        this.exibeDialogNovaAtividade();
    }//GEN-LAST:event_buttonNovaAtividadeActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                projetoEditarArvore dialog = new projetoEditarArvore(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    private void exibeDialogNovoTarefa() {
         String idAtividade = "0";
        dialogNovaTarefa.criarTarefaPorAtividade(idAtividade);
    }

    private void exibeDialogNovaAtividade() {
        dialogNovaAtividade.criarSubAtividade("22");
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton buttonEditar;
    private javax.swing.JButton buttonNovaAtividade;
    private javax.swing.JButton buttonNovaTarefa;
    private javax.swing.JButton buttonSair;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabelAtividadeAtivo;
    private javax.swing.JLabel jLabelAtividadeNome;
    private javax.swing.JLabel jLabelAtividadePercent;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanelResumoAtividade;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextArea jTextAreaAtividadeDescricao;
    private javax.swing.JTree jTreeAtividades;
    // End of variables declaration//GEN-END:variables
}
